package index;

import java.io.IOException;

import btree.BTFileScan;
import btree.BTreeFile;
import btree.ConstructPageException;
import btree.GetFileEntryException;
import btree.IteratorException;
import btree.KeyDataEntry;
import btree.KeyNotMatchException;
import btree.PinPageException;
import btree.ScanIteratorException;
import btree.UnpinPageException;

public class TripleIndexScan {

	private BTreeFile indexFile;
	private BTFileScan scan;
	
	public TripleIndexScan(String indexFileName) throws GetFileEntryException, PinPageException, ConstructPageException, KeyNotMatchException, IteratorException, UnpinPageException, IOException
	{
		indexFile = new BTreeFile(indexFileName);
		
		scan = indexFile.new_scan(null, null);
		
	}
	
	public KeyDataEntry get_next() throws ScanIteratorException
	{
		KeyDataEntry entry;
		while(true)
		{
			entry = scan.get_next();
			if(entry == null)
				return null;
			else
				return entry;
		}
			
	}
}
